package com.sunspring.jbug.service;

import com.sunspring.jbug.bean.VersionControl;
import com.sunspring.jbug.mapper.VersionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wulei
 * @date 2019-03-06
 **/
@Service
public class VersionService {

    @Autowired
    private VersionMapper versionMapper;

    /**
     * 创建新版本
     * @param versionControl VersionControl bean
     */
    public void create(VersionControl versionControl) {
        versionMapper.add(versionControl);
    }

    /**
     * 查看项目版本
     * @param projectId 项目Id
     * @return VersionControl list
     */
    public List<VersionControl> getVersion(Integer projectId) {
        return versionMapper.selectByProjectId(projectId);
    }

    /**
     * 删除项目版本
     * @param versionId versionId
     */
    public void deleteVersion(Integer versionId) {
        versionMapper.deleteById(versionId);
    }
}
